﻿using System;
using System.Linq;
using System.Collections.Generic;
using 为web添加unity.caching在controller中注入.DomainModels;
using 为web添加unity.caching在controller中注入.Models;
using 为web添加unity.caching在controller中注入.Repository;
using Project.UnityCaching;

namespace 为web添加unity.caching在controller中注入.BLL
{
    public interface IOrderService
    {
        [Caching(CachingMethod.Get)]
        List<Order_List> GetOrder(int skip, int count);
    }
    public class OrderService : IOrderService
    {

        EEE114Entities db = new EEE114Entities();
        public List<Order_List> GetOrder(int skip, int count)
        {
            var iOrderRepository = new OrderRepository(db);
            var iUserRepository = new UserRepository(db);
            var linq = from data1 in iOrderRepository.GetModel()
                       join data2 in iUserRepository.GetModel() on data1.UserID equals data2.UserID
                       select data1;
            return linq.OrderBy(i => i.OrderID)
                       .Skip(skip)
                       .Take(count)
                       .ToList();
        }
    }
}